#include<iostream>
using namespace std;
int main(){
    unsigned long long c=1;
    int a,b;
    cin>>a>>b;
    for(int i=0;i<b;i++){
        c*=a;
        if(c>1000000000){
            cout<<-1<<endl;
            exit(0);
        }
    }
    cout<<c<<endl;
    return 0;
}